package com.woyou.ui.activity.orderdetail;

import com.woyou.bean.OrderDetail;

import android.content.Context;
import android.view.View;

/**
 * 各订单状态对应的自定义View工厂
 * @author longtao.li
 *
 */
public class StateViewFactory {
	
//	CONFIRMED
//	SENT_OUT
//	DELICERED
//	COMMENTED
//	AUTO_COMPLETE
//	CANCELLATION
//	NEW_ORDER_ONLINEPAY
//	CANCELLED_ONLINEPAY
	
	private static StateViewCreater mStateViewCreater;
	
	public static View[] createStateView(Context context, ViewControl control, OrderDetail detail){
		View viewArr[] = null;
		switch (detail.getState()) {
		
		case State.CONFIRMED:
			// 订单已确认
			mStateViewCreater = new  SendOutOrderViewCreater(context, control, detail);
			viewArr = mStateViewCreater.getViewArr();
			break;
			
		case State.SENT_OUT:
			// 订单已送出
			mStateViewCreater = new  SendOutOrderViewCreater(context, control, detail);
			viewArr = mStateViewCreater.getViewArr();
			break;
			
		case State.DELICERED:
			// 订单已送达
			mStateViewCreater = new  ServedOrderViewCreater(context, control, detail);
			viewArr = mStateViewCreater.getViewArr();
			break;
			
		case State.COMMENTED:
			//实现对应的View
			mStateViewCreater = new  OrderCommentCreater(context, control, detail);
			viewArr = mStateViewCreater.getViewArr();
			break;
			
		case State.AUTO_COMPLETE:
			// 订单自动完成
			mStateViewCreater = new  AutoCompleteOrderViewCreater(context, control, detail);
			viewArr = mStateViewCreater.getViewArr();
			break;
			
		case State.CANCELLATION:
			//申请取消中
			mStateViewCreater = new  CancelingOrderViewCreater(context, control, detail);
			viewArr = mStateViewCreater.getViewArr();
			break;
			
		case State.NEW_ORDER_ONLINEPAY:
			//订单待支付状态
			mStateViewCreater = new  NewOrderOnlineViewCreater(context, control, detail);
			viewArr = mStateViewCreater.getViewArr();
			break;
			
		case State.CANCELLED_ONLINEPAY:
			//未支付被取消
			mStateViewCreater = new  NoPayBeCancelViewCreater(context, control, detail);
			viewArr = mStateViewCreater.getViewArr();
			break;

		default:
			viewArr = new View[0];
			break;
		}
		
		return viewArr;
		
	}
	
	
}
